package com.zyg.service.impl;

import com.zyg.pojo.User;

import com.zyg.service.Userservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.zyg.dao.UserMapper;

import java.util.List;

@Service("userService")
public class UserServiceImpl implements Userservice {
    @Autowired
    private UserMapper userMapper;
    public int addUser(User user){
        return userMapper.addUser(user);
    }
    public List<User> findAll(User user, int offset, int pageSize){
        //TODO
        List<User> users = userMapper.findAll(user, offset, pageSize);
        return users;
    }
    public User findById(Integer id){
        return userMapper.findById(id);
    }

    @Override
    public int UpdateUser(User user) {
        return userMapper.UpdateUser(user);
    }

    @Override
    public int DeleteUserById(Integer id) {
        return userMapper.DeleteUserById(id);
    }

    @Override
    public int count(User user) {
        return userMapper.count(user);
    }

    @Override
    public User login(User user) {
        return  userMapper.login(user);

    }

    @Override
    public int findUserByName(String name) {
        return userMapper.findUserByName(name);
    }

    @Override
    public int registUser(User user) {
        return userMapper.registUser(user);
    }
}
